//
//  RankingListStore.m
//  NewPro
//
//  Created by RYX on 2019/1/17.
//  Copyright © 2019 何荧红. All rights reserved.
//

#import "RankingListStore.h"
#import "RankingListModel.h"

@implementation RankingListStore

#pragma mark - 排行榜列表
- (void)getRankingListWithType:(NSString *)type andMonth:(NSString *)strDate Success:(void(^)(NSArray *listArr))success Failure:(void(^)(NSError *error))failure{
    
    NSString *url = [NSString stringWithFormat:@"%@/api/v1/top_income",IP];
    
    NSDictionary *dic = @{
                          @"type":type,
                          @"strDate":strDate
                          };
    
    [HttpTool getUrlWithString:url parameters:dic success:^(id responseObject) {
        
        NSError *error = [HttpTool inspectError:responseObject];
        if (error == nil) {
            
            NSArray *listArr = [RankingListModel mj_objectArrayWithKeyValuesArray:responseObject[@"data"][@"list"]];
            
            success(listArr);
        }else{
            
            failure(error);
        }
    } failure:^(NSError *error) {
        
        failure(error);
    }];
    
}

@end
